package com.xiaohu.demo.controller.address;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xiaohu.demo.service.address.AddressService;
import com.xiaohu.demo.utils.result.RequestResult;

@Controller
@RequestMapping("/address")
public class AddressController {
	@Resource
	private AddressService addressService;
	
	@RequestMapping("/getCity/{level}/{parentId}")
	@ResponseBody
	public RequestResult getCity(@PathVariable("level") String level,@PathVariable("parentId") String parentId) {
		List<Map<String,Object>> list = addressService.getCity(level,parentId);
		return new RequestResult("查询成功","200",list,true);
	}
	
	
	@RequestMapping("/getProvince")
	@ResponseBody
	public RequestResult getProvince() {
		List<Map<String,Object>> list = addressService.getProvince();
		return new RequestResult("查询成功","200",list,true);
	}
}
